/* ====================================================================
 * (#)Header: Address.java
 * (#)Revision: 
 * (#)Date Created: Mar 21, 2007 12:51:33 AM
 * (#)Created By: Karol Wozniak
 * ====================================================================
 *
 * Copyright (c) 2007 karolak .  All rights reserved.
 *
 * ====================================================================
 * 
 * The software application represented here is the sole property of 
 * karolak. Its unauthorized utilization is expressly prohibited.
 * 
 * ====================================================================
 */
package com.karolak.entity.element;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 * <code>Address</code> is used to ....
 * 
 * @author <a href="mailto:kwozniak@hotmail.com">Karol Wozniak</a>
 */
// TODO check indexes
@Embeddable
public class Address implements Serializable {

	private static final long serialVersionUID = 1L;

	protected String streetAddress;
	protected String city;
	protected String stateProvince;
	protected String country;
	protected String zipPostal;

	@Column(name = "street_address", nullable = true, length = 150)
	public String getStreetAddress() {
		return streetAddress;
	}

	public void setStreetAddress(String streetAddress) {
		this.streetAddress = streetAddress;
	}

	@Column(name = "city", nullable = true, length = 50)
	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	@Column(name = "state_province", nullable = true, length = 50)
	public String getStateProvince() {
		return stateProvince;
	}

	public void setStateProvince(String stateProvince) {
		this.stateProvince = stateProvince;
	}

	@Column(name = "country", nullable = true, length = 50)
	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	@Column(name = "zip_postal", nullable = true, length = 15)
	public String getZipPostal() {
		return zipPostal;
	}

	public void setZipPostal(String zipPostal) {
		this.zipPostal = zipPostal;
	}

	@Override
	public boolean equals(Object object) {
		if (this == object) {
			return true;
		}
		if (!(object instanceof Address)) {
			return false;
		}
		return false;
	}

	@Override
	public int hashCode() {
		int result;
		int number = 17;
		result = (getStreetAddress() != null ? getStreetAddress().hashCode() : 0);
		result = number * result + (getCity() != null ? getCity().hashCode() : 0);
		result = number * result + (getStateProvince() != null ? getStateProvince().hashCode() : 0);
		result = number * result + (getCountry() != null ? getCountry().hashCode() : 0);
		result = number * result + (getZipPostal() != null ? getZipPostal().hashCode() : 0);
		return result;
	}
}
